package com.java.consumer.controller;

import com.java.provider.api.EchoService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jiangli
 * @date 2019/11/8 23:25
 */
@RestController
@RefreshScope
public class EchoController {
	@Reference(version = "1.0.0")
	private EchoService echoService;
	@Value("${user.name}")
	private String username;

	@GetMapping("/echo/{name}")
	public String echo(@PathVariable("name") String name) {
		return echoService.echo(name) + username;
	}
}
